#include <stdio.h>

#define X 4
#define Y 3
#define Z 2

int buff[X][Y][Z];

void data_pre(){
    int cnt = 0;
    for (int i = 0; i < X; i++){
        for (int j = 0; j < Y; j++){
            for (int k = 0; k < Z; k++){
                buff[i][j][k] = cnt ++;
            }
        }
    }
}

void print_as_2d(int a[Y][Z]){
    for (int i = 0; i < Y; i++){
        for (int j = 0; j < Z; j++){
            printf("%4d,", a[i][j]);
        }
        printf("\n");
    }
    printf("\n");
}

int main(int argc, char const *argv[])
{
    data_pre();
    print_as_2d(buff[0]);
    print_as_2d(buff[1]);
    print_as_2d(buff[2]);
    print_as_2d(buff[3]);
    return 0;
}
